package com.example.shop.common.service;

import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsResponse;
import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsResponseBody;
import com.example.shop.common.dto.sms.ShortMessage;

import java.util.function.Consumer;
import java.util.function.Function;

public interface SMSService {

    /**
     * 异步发送一条短信
     * 异步接收处理该响应结果
     * @param shortMessage 短信
     * @return
     */
    public void asyncSendSms(ShortMessage shortMessage,
                             Consumer<? super SendSmsResponse> success,Function<Throwable, ? extends Void> error);
    /**
     * 异步发送一条短信
     * 同步接收处理该响应结果
     * @param shortMessage 短信
     * @return
     */
    public SendSmsResponseBody sendSms(ShortMessage shortMessage);



}
